<?php

namespace app\health\validate;

class LoginValidate extends BaseValidate
{
    protected $rule = [
        'wx_phone_code' => 'require',
        'wx_login_code' => 'require',
        'mobile'        => 'require|mobile',
        'mobile_code'   => 'require|checkMobileCode',
    ];

    protected $message = [
        'wx_phone_code.require' => '微信授权手机code必须',
        'wx_login_code.require' => '微信登录code必须',
        'mobile.require'        => '请输入手机号',
        'mobile_code.require'   => '请输入短信验证码',
    ];

    // 场景验证
    protected $scene = [
        //微信授权登录
        'wnpLogin'       => ['wx_login_code'],
        //微信手机一键授权
        'wnpMobileLogin' => ['wx_phone_code', 'wx_login_code'],
        //手机验证码登录
        'mobile'         => ['mobile', 'mobile_code', 'wx_login_code'],
    ];
}
